import xml.dom.minidom
import urllib
import urllib2
from MTurkUtility import SERVICE_URL

def SendMTurkRequest(param):
    result_xmlstr = urllib2.urlopen(SERVICE_URL+str( urllib.urlencode(param.parameters))).read()
    result_xml = xml.dom.minidom.parseString(result_xmlstr)
    
        # Check for and print results and errors
    errors_nodes = result_xml.getElementsByTagName('Errors')
    if errors_nodes:
        return None
    else:
        return result_xml

        
